import {_decorator, Component} from 'cc';
import {PoolManager} from "db://assets/scripts/common/PoolManager";
import {MonsterController} from "db://assets/scripts/game/role/monster/MonsterController";

const {ccclass, property} = _decorator;

/**
 * 长条状预警脚本
 */
@ccclass('WarningStripEffect')
export class WarningStripEffect extends Component {
    /**
     * 使用者
     */
    private parentScript: MonsterController;

    /**
     * 初始化长条状预警脚本
     *
     * @param zScale z轴上的缩放比
     * @param parentScript 使用者
     */
    public init(zScale: number, parentScript: MonsterController) {
        parentScript.recycleWarning();
        this.parentScript = parentScript;
        this.node.setWorldPosition(parentScript.node.worldPosition.x, 2.5, parentScript.node.worldPosition.z);
        this.node.forward = parentScript.attackForward;
        this.node.setScale(1, 1, zScale);

        this.showWarning();
    }

    /**
     * 显示预警
     */
    public showWarning() {

    }

    /**
     * 隐藏预警
     */
    public hideWarning() {
        PoolManager.getInstance().putNode(this.node);
    }
}